<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="java.util.List"%>
<%@ page import="jt.classic.app.gdzc.GdzcTemplate"%>
<%@ page import="jt.classic.app.gdzc.GdzcTemplateItem"%>
<%@ page import="jt.classic.app.gdzc.impl.GdzcTemplateImpl"%>
<%
	String context = jt.classic.system.ISystem.getContextPath();
	GdzcTemplate template = (GdzcTemplate) request
			.getAttribute("template");

	List commonList = template.items(GdzcTemplateImpl.PROP_COMMON);
	List baseList = template.items(GdzcTemplateImpl.PROP_BASE);
	List configList = template.items(GdzcTemplateImpl.PROP_CONFIG);
	List financeList = template.items(GdzcTemplateImpl.PROP_FINANCE);
	List maintenList = template.items(GdzcTemplateImpl.PROP_MAINTEN);

	out.println("<script>");
	out.println("var components = [];");

	if (commonList != null && !commonList.isEmpty()) {
		for (int i = 0; i < commonList.size(); i++) {
			GdzcTemplateItem item = (GdzcTemplateItem) commonList
			.get(i);
			out.println("var params = {};");
			out.println("params.id = '" + item.id() + "'");
			out.println("params.name = '" + item.iname() + "'");
			out.println("params.columnName = '" + item.icolumn().getName() + "'");
			out.println("params.tableName = '" + item.icolumn().associateTable().getName() + "'");
			out.println("params.desc = '" + item.idesc() + "'");
			out.println("params.dvalue = '" + item.idvalue() + "'");
			out.println("params.label = '" + item.ilabel() + "'");
			out.println("params.type = '" + item.itype() + "'");
			out.println("params.checkBlank = " + item.icheck(0) + "");
			out.println("params.checkType = " + item.icheck(1) + "");
			
			out.println("components.push(params)");
		}
	}

	if (baseList != null && !baseList.isEmpty()) {
		for (int i = 0; i < baseList.size(); i++) {
			GdzcTemplateItem item = (GdzcTemplateItem) baseList.get(i);
			out.println("var params = {};");
			out.println("params.id = '" + item.id() + "'");
			out.println("params.name = '" + item.iname() + "'");
			out.println("params.columnName = '" + item.icolumn().getName() + "'");
			out.println("params.tableName = '" + item.icolumn().associateTable().getName() + "'");
			out.println("params.desc = '" + item.idesc() + "'");
			out.println("params.dvalue = '" + item.idvalue() + "'");
			out.println("params.label = '" + item.ilabel() + "'");
			out.println("params.type = '" + item.itype() + "'");
			out.println("params.checkBlank = " + item.icheck(0) + "");
			out.println("params.checkType = " + item.icheck(1) + "");
			
			out.println("components.push(params)");
		}
	}

	if (configList != null && !configList.isEmpty()) {
		for (int i = 0; i < configList.size(); i++) {
			GdzcTemplateItem item = (GdzcTemplateItem) configList
			.get(i);
			out.println("var params = {};");
			out.println("params.id = '" + item.id() + "'");
			out.println("params.name = '" + item.iname() + "'");
			out.println("params.columnName = '" + item.icolumn().getName() + "'");
			out.println("params.tableName = '" + item.icolumn().associateTable().getName() + "'");
			out.println("params.desc = '" + item.idesc() + "'");
			out.println("params.dvalue = '" + item.idvalue() + "'");
			out.println("params.label = '" + item.ilabel() + "'");
			out.println("params.type = '" + item.itype() + "'");
			out.println("params.checkBlank = " + item.icheck(0) + "");
			out.println("params.checkType = " + item.icheck(1) + "");
			
			out.println("components.push(params)");
		}
	}

	if (financeList != null && !financeList.isEmpty()) {
		for (int i = 0; i < financeList.size(); i++) {
			GdzcTemplateItem item = (GdzcTemplateItem) financeList
			.get(i);
			out.println("var params = {};");
			out.println("params.id = '" + item.id() + "'");
			out.println("params.name = '" + item.iname() + "'");
			out.println("params.columnName = '" + item.icolumn().getName() + "'");
			out.println("params.tableName = '" + item.icolumn().associateTable().getName() + "'");
			out.println("params.desc = '" + item.idesc() + "'");
			out.println("params.dvalue = '" + item.idvalue() + "'");
			out.println("params.label = '" + item.ilabel() + "'");
			out.println("params.type = '" + item.itype() + "'");
			out.println("params.checkBlank = " + item.icheck(0) + "");
			out.println("params.checkType = " + item.icheck(1) + "");
			
			out.println("components.push(params)");
		}
	}

	if (maintenList != null && !maintenList.isEmpty()) {
		for (int i = 0; i < maintenList.size(); i++) {
			GdzcTemplateItem item = (GdzcTemplateItem) maintenList
			.get(i);
			out.println("var params = {};");
			out.println("params.id = '" + item.id() + "'");
			out.println("params.name = '" + item.iname() + "'");
			out.println("params.columnName = '" + item.icolumn().getName() + "'");
			out.println("params.tableName = '" + item.icolumn().associateTable().getName() + "'");
			out.println("params.desc = '" + item.idesc() + "'");
			out.println("params.dvalue = '" + item.idvalue() + "'");
			out.println("params.label = '" + item.ilabel() + "'");
			out.println("params.type = '" + item.itype() + "'");
			out.println("params.checkBlank = " + item.icheck(0) + "");
			out.println("params.checkType = " + item.icheck(1) + "");
			
			out.println("components.push(params)");
		}
	}

	out.println("</script>");
%>
